﻿<UserControl x:Class="TetriBricks.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
			 xmlns:local="clr-namespace:TetriBricks" 
			 xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows" 
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			 mc:Ignorable="d" 
			 Background="Transparent" Loaded="UserControl_Loaded">
	<UserControl.Resources>
		<local:ShortDateTimeConverter x:Key="ShortDateTimeConverter" />
		<Style x:Key="GlassToggleButton" TargetType="ToggleButton">
			<Setter Property="Background" Value="#FF1F3B53" />
			<Setter Property="Foreground" Value="#FF000000" />
			<Setter Property="Padding" Value="3" />
			<Setter Property="BorderThickness" Value="1" />
			<Setter Property="BorderBrush">
				<Setter.Value>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FFA3AEB9" Offset="0" />
						<GradientStop Color="#FF8399A9" Offset="0.375" />
						<GradientStop Color="#FF718597" Offset="0.375" />
						<GradientStop Color="#FF617584" Offset="1" />
					</LinearGradientBrush>
				</Setter.Value>
			</Setter>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="ToggleButton">
						<Grid>
							<vsm:VisualStateManager.VisualStateGroups>
								<vsm:VisualStateGroup x:Name="CommonStates">
									<vsm:VisualState x:Name="Normal" />
									<vsm:VisualState x:Name="MouseOver">
										<Storyboard>
											<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
												<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1" />
											</DoubleAnimationUsingKeyFrames>
										</Storyboard>
									</vsm:VisualState>
									<vsm:VisualState x:Name="Pressed">

										<Storyboard>
											<ColorAnimationUsingKeyFrames Storyboard.TargetName="border" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
												<SplineColorKeyFrame KeyTime="0" Value="#CC000000" />
											</ColorAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetName="shine" Storyboard.TargetProperty="Opacity">
												<SplineDoubleKeyFrame KeyTime="0" Value="0.4" />
											</DoubleAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Visibility)">
												<DiscreteObjectKeyFrame KeyTime="00:00:00">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Collapsed</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</vsm:VisualState>
									<vsm:VisualState x:Name="Disabled">
										<!-- <Storyboard>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity">
												<SplineDoubleKeyFrame KeyTime="0" Value=".55"/>
											</DoubleAnimationUsingKeyFrames>
										</Storyboard> -->
									</vsm:VisualState>
								</vsm:VisualStateGroup>
								<vsm:VisualStateGroup x:Name="FocusStates">
									<vsm:VisualState x:Name="Focused">
										<!--<Storyboard>
											<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
												<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
											</DoubleAnimationUsingKeyFrames>
										</Storyboard>-->
									</vsm:VisualState>
									<vsm:VisualState x:Name="Unfocused" />
								</vsm:VisualStateGroup>
							</vsm:VisualStateManager.VisualStateGroups>
							<Border BorderBrush="DarkGray" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4">
								<Border x:Name="border" Background="#7F000000" BorderBrush="#FF000000" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4">
									<Grid>
										<Grid.RowDefinitions>
											<RowDefinition Height="0.507*" />
											<RowDefinition Height="0.493*" />
										</Grid.RowDefinitions>
										<Border Opacity="0" HorizontalAlignment="Stretch" x:Name="glow" Width="Auto" Grid.RowSpan="2" CornerRadius="4,4,4,4">
											<Border.Background>
												<RadialGradientBrush>
													<RadialGradientBrush.RelativeTransform>
														<TransformGroup>
															<ScaleTransform ScaleX="1.702" ScaleY="2.243" />
															<SkewTransform AngleX="0" AngleY="0" />
															<RotateTransform Angle="0" />
															<TranslateTransform X="-0.368" Y="-0.152" />
														</TransformGroup>
													</RadialGradientBrush.RelativeTransform>
													<GradientStop Color="#B28DBDFF" Offset="0" />
													<GradientStop Color="#008DBDFF" Offset="1" />
												</RadialGradientBrush>
											</Border.Background>
										</Border>
										<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" Grid.RowSpan="2" />
										<Border HorizontalAlignment="Stretch" Margin="0,0,0,0" x:Name="shine" Width="Auto" CornerRadius="4,4,0,0">
											<Border.Background>
												<LinearGradientBrush EndPoint="0.494,0.889" StartPoint="0.494,0.028">
													<GradientStop Color="#99FFFFFF" Offset="0" />
													<GradientStop Color="#33FFFFFF" Offset="1" />
												</LinearGradientBrush>
											</Border.Background>
										</Border>
									</Grid>
								</Border>
							</Border>

						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="GlassButton" TargetType="Button">
			<Setter Property="Background" Value="#FF1F3B53" />
			<Setter Property="Foreground" Value="#FF000000" />
			<Setter Property="Padding" Value="3" />
			<Setter Property="BorderThickness" Value="1" />
			<Setter Property="BorderBrush">
				<Setter.Value>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FFA3AEB9" Offset="0" />
						<GradientStop Color="#FF8399A9" Offset="0.375" />
						<GradientStop Color="#FF718597" Offset="0.375" />
						<GradientStop Color="#FF617584" Offset="1" />
					</LinearGradientBrush>
				</Setter.Value>
			</Setter>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="Button">
						<Grid>
							<vsm:VisualStateManager.VisualStateGroups>
								<vsm:VisualStateGroup x:Name="CommonStates">
									<vsm:VisualState x:Name="Normal" />
									<vsm:VisualState x:Name="MouseOver">
										<Storyboard>
											<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
												<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1" />
											</DoubleAnimationUsingKeyFrames>
										</Storyboard>
									</vsm:VisualState>
									<vsm:VisualState x:Name="Pressed">

										<Storyboard>
											<ColorAnimationUsingKeyFrames Storyboard.TargetName="border" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
												<SplineColorKeyFrame KeyTime="0" Value="#CC000000" />
											</ColorAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetName="shine" Storyboard.TargetProperty="Opacity">
												<SplineDoubleKeyFrame KeyTime="0" Value="0.4" />
											</DoubleAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Visibility)">
												<DiscreteObjectKeyFrame KeyTime="00:00:00">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Collapsed</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</vsm:VisualState>
									<vsm:VisualState x:Name="Disabled">
										<!-- <Storyboard>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity">
												<SplineDoubleKeyFrame KeyTime="0" Value=".55"/>
											</DoubleAnimationUsingKeyFrames>
										</Storyboard> -->
									</vsm:VisualState>
								</vsm:VisualStateGroup>
								<vsm:VisualStateGroup x:Name="FocusStates">
									<vsm:VisualState x:Name="Focused">
										<!--<Storyboard>
											<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
												<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
											</DoubleAnimationUsingKeyFrames>
										</Storyboard>-->
									</vsm:VisualState>
									<vsm:VisualState x:Name="Unfocused" />
								</vsm:VisualStateGroup>
							</vsm:VisualStateManager.VisualStateGroups>
							<Border BorderBrush="DarkGray" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4">
								<Border x:Name="border" Background="#7F000000" BorderBrush="#FF000000" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4">
									<Grid>
										<Grid.RowDefinitions>
											<RowDefinition Height="0.507*" />
											<RowDefinition Height="0.493*" />
										</Grid.RowDefinitions>
										<Border Opacity="0" HorizontalAlignment="Stretch" x:Name="glow" Width="Auto" Grid.RowSpan="2" CornerRadius="4,4,4,4">
											<Border.Background>
												<RadialGradientBrush>
													<RadialGradientBrush.RelativeTransform>
														<TransformGroup>
															<ScaleTransform ScaleX="1.702" ScaleY="2.243" />
															<SkewTransform AngleX="0" AngleY="0" />
															<RotateTransform Angle="0" />
															<TranslateTransform X="-0.368" Y="-0.152" />
														</TransformGroup>
													</RadialGradientBrush.RelativeTransform>
													<GradientStop Color="#B28DBDFF" Offset="0" />
													<GradientStop Color="#008DBDFF" Offset="1" />
												</RadialGradientBrush>
											</Border.Background>
										</Border>
										<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" Grid.RowSpan="2" />
										<Border HorizontalAlignment="Stretch" Margin="0,0,0,0" x:Name="shine" Width="Auto" CornerRadius="4,4,0,0">
											<Border.Background>
												<LinearGradientBrush EndPoint="0.494,0.889" StartPoint="0.494,0.028">
													<GradientStop Color="#99FFFFFF" Offset="0" />
													<GradientStop Color="#33FFFFFF" Offset="1" />
												</LinearGradientBrush>
											</Border.Background>
										</Border>
									</Grid>
								</Border>
							</Border>

						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</UserControl.Resources>

	<Grid ShowGridLines="False" Background="Transparent">
		<vsm:VisualStateManager.VisualStateGroups>
			<vsm:VisualStateGroup x:Name="VisualStateGroup">
				<vsm:VisualStateGroup.Transitions>
					<vsm:VisualTransition GeneratedDuration="00:00:00.2000000" />
				</vsm:VisualStateGroup.Transitions>
				<vsm:VisualState x:Name="Enlarged">
					<Storyboard>
						<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
							<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.1" />
						</DoubleAnimationUsingKeyFrames>
						<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
							<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.1" />
						</DoubleAnimationUsingKeyFrames>
					</Storyboard>
				</vsm:VisualState>
				<vsm:VisualState x:Name="Normal" />
			</vsm:VisualStateGroup>
		</vsm:VisualStateManager.VisualStateGroups>
		<Grid.RowDefinitions>
			<RowDefinition Height="1" />
			<RowDefinition Height="*" />
			<RowDefinition Height="1" />
		</Grid.RowDefinitions>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="5" />
			<ColumnDefinition Width="*" />
			<ColumnDefinition Width="5" />
		</Grid.ColumnDefinitions>
		<StackPanel Width="370" Grid.Row="1" Grid.Column="1" Name="MainPanel" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.484,0.515">
			<Border>
				<StackPanel>
					<Border Width="370" Background="Black" CornerRadius="5" Margin="0,5,0,5">
						<TextBlock Grid.Row="0" Grid.Column="1" Margin="0,5,0,5" Name="TitleText" Padding="0" HorizontalAlignment="Center" FontSize="24" Foreground="AliceBlue">TetriBricks</TextBlock>
					</Border>
					<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
						<Border Padding="5" CornerRadius="5,5,5,5" Background="Black">
							<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top">
								<Border Padding="0" Background="Black">
									<Grid Margin="0,0,0,6" VerticalAlignment="Top">
										<Grid.RowDefinitions>
											<RowDefinition />
										</Grid.RowDefinitions>
										<Grid.ColumnDefinitions>
											<ColumnDefinition Width="Auto" />
											<ColumnDefinition Width="Auto" />
											<ColumnDefinition Width="Auto" />
											<ColumnDefinition Width="100*" />
										</Grid.ColumnDefinitions>
										<ToggleButton Style="{StaticResource GlassToggleButton}" Grid.Row="1" Grid.Column="0" Name="btnHighScores" Checked="ToggleButton_Checked" Unchecked="ToggleButton_Unchecked" Foreground="White" IsThreeState="False">
											<StackPanel Orientation="Horizontal">
												<TextBlock VerticalAlignment="Center" Text="Hi-Scores" Margin="3" />
											</StackPanel>
										</ToggleButton>
										<Button Style="{StaticResource GlassButton}" Grid.Row="1" Grid.Column="1" Click="btnBack_Click" Name="btnBack" Foreground="White">
											<StackPanel Orientation="Horizontal">
												<Image Source="images/Undo.png" ToolTipService.ToolTip="Undo" Margin="0" />
												<TextBlock VerticalAlignment="Center" Text="Undo" Margin="3" />
											</StackPanel>
										</Button>
										<Button Style="{StaticResource GlassButton}" Grid.Row="1" Grid.Column="2" Click="btnNext_Click" Name="btnNext" Foreground="White">
											<StackPanel Orientation="Horizontal">
												<Image Source="images/Redo.png" ToolTipService.ToolTip="Redo" Margin="0" />
												<TextBlock VerticalAlignment="Center" Text="Redo" Margin="3" />
											</StackPanel>
										</Button>

										<Button Style="{StaticResource GlassButton}" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="3" Click="btnReload_Click" Name="btnReload" Foreground="White">
											<StackPanel Orientation="Horizontal">
												<Image Source="images/Reload.png" ToolTipService.ToolTip="New Game" Margin="0" />
												<TextBlock VerticalAlignment="Center" Text="New Game" Margin="3" />
											</StackPanel>
										</Button>
									</Grid>
								</Border>
								<Border Padding="0" CornerRadius="5" Background="Black">
									<Canvas x:Name="MainCanvas" Width="360" Height="360">
										<!-- high scores -->
										<Border Width="360" Height="360" Canvas.Left="0" Canvas.Top="0" Canvas.ZIndex="1" x:Name="panelHighScores" CornerRadius="5" Background="Black">
											<StackPanel Orientation="Vertical" Background="Transparent">
												<TextBlock Name="lblHallOfFame" Padding="0" HorizontalAlignment="Center" FontSize="14" Height="20" Foreground="AliceBlue">Hall Of Fame</TextBlock>
												<ListBox Width="360" Height="340" Name="listViewHighScores">
													<ListBox.ItemTemplate>
														<DataTemplate>
															<Grid>
																<Grid.RowDefinitions>
																	<RowDefinition Height="*" />
																</Grid.RowDefinitions>
																<Grid.ColumnDefinitions>
																	<ColumnDefinition Width="40" />
																	<ColumnDefinition Width="150" />
																	<ColumnDefinition Width="*" />
																</Grid.ColumnDefinitions>
																<TextBlock Margin="5,0,0,0" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" FontSize="14" Name="Score" Text="{Binding ScoreValue}" Foreground="Black" />
																<TextBlock Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="10" Name="Name" Text="{Binding UserName}" Foreground="Black" />
																<TextBlock Grid.Row="0" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="10" Name="Date" Text="{Binding ScoreDate,Converter={StaticResource ShortDateTimeConverter}}" Foreground="DarkGray" />
															</Grid>
														</DataTemplate>
													</ListBox.ItemTemplate>
												</ListBox>
											</StackPanel>
										</Border>
										<!-- high scores -->

										<!-- puzzle -->
										<Border Width="360" Height="360" Canvas.Left="0" Canvas.Top="0" Canvas.ZIndex="1" x:Name="panelGameBoard" CornerRadius="5" Background="Black">
											<StackPanel Canvas.Left="0" Canvas.Top="0" Canvas.ZIndex="2" Width="360" Height="360" Orientation="Horizontal" Name="gridPuzzle" HorizontalAlignment="Left" VerticalAlignment="Center">
											</StackPanel>
										</Border>
										<!-- puzzle -->

										<Border Canvas.Left="0" Canvas.Top="0" Height="360" Width="360" Canvas.ZIndex="3" Name="panelSubmitHighScore" Background="LightGoldenrodYellow" CornerRadius="5,5,5,5" Margin="0,0,0,0" Visibility="Collapsed">
											<StackPanel Orientation="Vertical" Margin="5" HorizontalAlignment="Left">
												<TextBlock Height="29" Name="lblHighScore" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="10" FontSize="14" FontWeight="Bold">
													<Run Text="Congratulations !!!!" />
												</TextBlock>
												<TextBlock HorizontalAlignment="Left" Margin="5" Name="label4" VerticalAlignment="Top" TextWrapping="Wrap" FontSize="12">
													<Run Text="You are eligible to join the TetriBricks Hall Of Fame. Please type a user name and click Submit. (You can also elect to be notified if someone passes your score in the future)" />
												</TextBlock>
												<TextBlock HorizontalAlignment="Left" Margin="5" Name="label5" VerticalAlignment="Bottom" FontSize="12">
													<Run Text="User Name :" />
												</TextBlock>
												<TextBox HorizontalAlignment="Left" Margin="5" Width="330" Name="textUserName" Height="26" />
												<CheckBox HorizontalAlignment="Left" Margin="5" Width="330" Name="checkBoxNotify" Click="checkBoxNotify_Checked">
													<TextBlock Text="Notify me if/when my score is beat (optional)" />
												</CheckBox>
												<TextBlock HorizontalAlignment="Left" Margin="3,0,5,0" Width="330" Name="label1" VerticalAlignment="Bottom" Text="Email :" FontSize="12"></TextBlock>
												<TextBox HorizontalAlignment="Left" Margin="5" Width="330" Name="textBoxEmail" VerticalAlignment="Bottom" Height="26" />
												<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,15,0,0">
													<Button HorizontalAlignment="Right" Margin="5" Width="75" Name="buttonCancel" VerticalAlignment="Bottom" Content="Cancel" Click="buttonCancel_Click" />
													<Button HorizontalAlignment="Right" Margin="5" Width="75" Name="buttonSubmitScore" VerticalAlignment="Bottom" Content="Submit" Click="buttonSubmitScore_Click" />
												</StackPanel>
											</StackPanel>
										</Border>
									</Canvas>
								</Border>
							</StackPanel>
						</Border>
					</StackPanel>
					<Border Width="370" Background="Black" CornerRadius="5" Margin="0,5,0,5">
						<Grid>
							<Grid.RowDefinitions>
								<RowDefinition Height="*" />
							</Grid.RowDefinitions>
							<Grid.ColumnDefinitions>
								<ColumnDefinition />
								<ColumnDefinition />
								<ColumnDefinition />
								<ColumnDefinition />
							</Grid.ColumnDefinitions>
							<TextBlock Grid.Row="1" Grid.Column="0" Name="LabelPoints" Padding="5" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="14" FontWeight="Bold" Foreground="AliceBlue">Points :</TextBlock>
							<TextBlock Grid.Row="1" Grid.Column="1" Name="Points" Padding="5" VerticalAlignment="Center" HorizontalAlignment="Right" FontSize="16" FontWeight="Bold" Foreground="AliceBlue">0</TextBlock>
							<TextBlock Grid.Row="1" Grid.Column="2" Name="LabelScore" Padding="5" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="14" FontWeight="Bold" Foreground="AliceBlue">Score :</TextBlock>
							<TextBlock Grid.Row="1" Grid.Column="3" Name="Score" Padding="5" VerticalAlignment="Center" HorizontalAlignment="Right" FontSize="16" FontWeight="Bold" Foreground="AliceBlue">0</TextBlock>
						</Grid>
					</Border>
					<Border Background="Transparent" CornerRadius="5" Margin="0,5,0,5">
						<TextBlock Grid.Row="2" Grid.Column="1" Margin="5,0,0,0" Name="txtStatus" Padding="0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="12" Foreground="White">
							<Run Text=""></Run>
						</TextBlock>
					</Border>
				</StackPanel>
			</Border>
		</StackPanel>
	</Grid>
</UserControl>